﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using PJ.Business;
using Microsoft.Practices.Composite.Events;
using PJ.Business.SalePurchase.Sale;
using PJ.Business.Partner;
using PJ.Presentation.Partner;
using PJ.Data;

namespace PJ.Presentation.SalePurchase.Sale
{
    public class CustomerShoppingCartItemListModel : ShoppingCartItemListModel<CustomerShoppingCartItemModel>, ICustomerShoppingCartItemListModel
    {
        [Microsoft.Practices.Unity.InjectionConstructor]
        public CustomerShoppingCartItemListModel(ICustomerShoppingCartItemListView view, IEventAggregator aggregator, ICustomerShoppingCartItemService service)
            : base(view, aggregator, service)
        {
            EventAggregator.GetEvent<CustomerSelectionEvent>().Subscribe(ParentChange);
        }
        #region Protected



        protected override IBusinessObjectModel CreateNewItem(string globalId)
        {
            if (globalId == null || globalId == "")
                throw new ArgumentNullException("globalId");
            CustomerShoppingCartItemModel model = new CustomerShoppingCartItemModel(globalId, (ICustomerShoppingCartItemService)Service);
            model.SetValues(Service.GetData(globalId, GetDataMode.UseCache), false);
            return model;
        }
        protected override IBusinessObjectModel CreateNewItem(IBusinessObject obj)
        {
            return new CustomerShoppingCartItemModel(obj, (ICustomerShoppingCartItemService)Service);
        }
        #endregion

        #region Field

        #endregion



        public override void SelectionChange(IBusinessObjectModel businessObject)
        {
        }
    }
}
